﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace proyecto
{
    /// <summary>
    /// Lógica de interacción para Histogram_Design.xaml
    /// </summary>
    public partial class BoxPlott_Design : Window
    {

        int nSeries;
        ComboBox[] combos;

        public BoxPlott_Design()
        {
            InitializeComponent();
        }

        public BoxPlott_Design(string[][] groups, int[] nGroups, int nClass)
        {
            combos = new ComboBox[100];

            InitializeComponent();

            comboBox3.Items.Add("All_groups");
            comboBox3.SelectedIndex = 0;

            for (int i = 0; i < nClass; i++)
            {
                for (int j = 0; j < nGroups[i]; j++)
                {
                    comboBox3.Items.Add(groups[i][j]);
                }

            }

            nSeries = 1;
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            combos[nSeries - 1] = new ComboBox();
            for (int i = 0; i < comboBox3.Items.Count; i++)
            {
                combos[nSeries - 1].Items.Add(comboBox3.Items[i]);
            }

            DockPanel.SetDock(combos[nSeries - 1], Dock.Top);

            combos[nSeries - 1].Width = 250;
            combos[nSeries - 1].Height = 23;
            combos[nSeries - 1].SelectedIndex = 0;
            dockPanel6.Children.Add(combos[nSeries - 1]);


            nSeries++;
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
            this.Close();

        }

        private void button3_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
        }

        public int get_nSeries()
        {
            return nSeries;
        }


        public int get_Series(int i)
        {
            if (i == 0)
                return comboBox3.SelectedIndex - 1;

            else
                return combos[i - 1].SelectedIndex - 1;
        }

        public string getLabel(int i)
        {
            if (i == 0)
                return comboBox3.SelectedItem.ToString();
            else
                return (combos[i-1].SelectedItem.ToString());
        }

       

    }
}
